/*
 * Delay3.java
 * 
 * last update: 16.01.2010 by Stefan Saru
 * 
 * author:	Alec(panovici@elcom.pub.ro)
 * 
 * Obs:
 */

package engine;

/**
 * Used as a structure to store a delay3
 */

class Delay3{

	Delay3Description desc;

	public int expandType; 

	public int delaySpecs; //how many delays below are valid
	//         rising     falling    turn-off
	public int delay1Typ, delay2Typ, delay3Typ;
	public int delay1Min, delay2Min, delay3Min;
	public int delay1Max, delay2Max, delay3Max;


	public String toString() {
		String res = "#(";
		switch (delaySpecs) {
		case 3:
			res += delay3Min + ":" + delay3Typ + ":" + delay3Max + ", ";
		case 2:
			res += delay2Min + ":" + delay2Typ + ":" + delay2Max + ", ";
		case 1:
			res += delay1Min + ":" + delay1Typ + ":" + delay1Max;
		}
		return res + ")";
	}

	public void setDelay1(int min, int typ, int max) {
		delay1Min = min;
		delay1Typ = typ;
		delay1Max = max;
	}

	public void setDelay2(int min, int typ, int max) {
		delay2Min = min;
		delay2Typ = typ;
		delay2Max = max;
	}

	public void setDelay3(int min, int typ, int max) {
		delay3Min = min;
		delay3Typ = typ;
		delay3Max = max;
	}

	public static final Delay3 nullDelay () {
		try {
			return Delay3Description.nullDelay.instantiate(null);
		} catch (Exception ex) {}
		return null;
	}
}


